//
//  SceneFactory.m
//  ZXLSign
//
//  Created by awh on 2020/11/8.
//

#import "SceneFactory.h"
#import "ZXLAPI.h"
#import "ZXLCustom.h"
@interface SceneFactory ()
@property(nonatomic,strong)ZXLAPI * zxlApi;
@end
@implementation SceneFactory
- (instancetype)initConfig:(ZXLConfig *)config
{    self=[super init];
    if (self) {
        [self createScene:config];
        self.sceneConfig =config;
    }
    return self;
}
-(void)createScene:(ZXLConfig*)cfj{
    switch (cfj.sceneType) {
        case SecurityTypeAPI:
        {
            _zxlApi= [[ZXLAPI alloc]initConfig:cfj];
        }
            break;
            
        default:
            break;
    }
}

- (NSString *)currentTimestamp {
    NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//获取当前时间0秒后的时间
    NSTimeInterval time=[date timeIntervalSince1970]*1000;// *1000 是精确到毫秒，不乘就是精确到秒
    NSString *timeString = [NSString stringWithFormat:@"%.0f", time];
    return timeString;
}
- (NSString *)getNonce{
    return [NSString stringWithFormat:@"%d",(arc4random() % 1000001) + 1000000];
}

@end
